<%@page import="complex.services.PlayersService"%>
<%@page
	import="org.springframework.web.context.support.WebApplicationContextUtils"%>
<%@page import="org.springframework.web.context.WebApplicationContext"%>
<%@page import="complex.dto.Player"%>
<%@page import="java.util.List"%>
<%@page language="java" contentType="text/html; charset=UTF-8"
	pageEncoding="UTF-8"%>

<%
	WebApplicationContext wac = WebApplicationContextUtils.getRequiredWebApplicationContext(getServletContext());
	PlayersService playersService = (PlayersService) wac.getBean("playersService");
	List<Player> players = playersService.getAllPlayers();
%>

<html>
<head>
<title>Головна сторінка порталу</title>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
<meta http-equiv="Pragma" content="no-cache">
<meta http-equiv="Cache-Control" content="no-cache">
<meta http-equiv="Expires" content="Sat, 01 Dec 2001 00:00:00 GMT">
<meta http-equiv="X-UA-Compatible" content="IE=edge">

<link href="resources/bootstrap.css" rel="stylesheet" />
</head>
<body class="container" style="padding: 10px;">
	<div class="panel panel-info" >
		<div class="panel-heading"><h4>Список гравців</h4></div>
		<div class="panel-body">
			<table
				class="table table-hover table-condensed table-responsive table-bordered table-striped">
				<thead>
					<th>Ім'я</th>
					<th>Прізвище</th>
					<th>Дата народження</th>
				</thead>
				<tbody>
					<%
						for (Player p : players) {
					%>
					<tr>
						<td><%=p.getFirstName()%></td>
						<td><%=p.getLastName()%></td>
						<td><%=p.getBirthDate().getTime()%></td>
					</tr>
					<%
						}
					%>
				</tbody>
			</table>
		</div>
	</div>
</body>
</html>

